﻿using System;
using System.Drawing;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using SenseTimeTracker.BusinessLayer;
using SenseTimeTracker.CommonSenseControls;
using StedySoft.SenseSDK;

namespace SenseTimeTracker.Categories
{
	public class CategoryDisplayItem : CommonSenseDisplayPanelItem
	{
		private Category category;

		public CategoryDisplayItem()
		{
			Height = 50;
		}

		public Category Category
		{
			get { return category; }
			set { category = value; }
		}

		#region ISenseListItem Members

		public override void OnRender(Graphics g)
		{
			using (Brush brush = new SolidBrush(Color.Black))
			using (Brush selectionBrush = new SolidBrush(Color.Gray))
			using (Font primaryFont = new Font("Helvetica Neue OTS", 9f, FontStyle.Regular))
			{
				if (selected)
				{
					g.FillRectangle(selectionBrush, ClientRectangle);
				}
				SizeF primaryTextSize = g.MeasureString(category.Name, primaryFont);
				g.DrawString(category.Name, primaryFont, brush, ClientRectangle.Left + 8, ClientRectangle.Top + ClientRectangle.Height / 2 - primaryTextSize.Height / 2);
			}

			base.OnRender(g);
		}

		#endregion
	}
}
